# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=c-ares
pkgver=1.28.1
pkgrel=0
pkgdesc="Asynchronous DNS/names resolver library"
url="https://c-ares.org/"
arch="all"
license="MIT"
makedepends="gtest-dev"
subpackages="$pkgname-doc $pkgname-static $pkgname-dev $pkgname-utils::noarch"
source="https://c-ares.haxx.se/download/c-ares-$pkgver.tar.gz"

# secfixes:
#   1.27.0-r0:
#     - CVE-2024-25629
#   1.17.2-r0:
#     - CVE-2021-3672

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared
	make
}

check() {
	test/arestest --gtest_filter=-*.Live*
}

package() {
	make DESTDIR="$pkgdir" install
	cd src/tools
	install -Dm755 -t "$pkgdir"/usr/bin \
		adig ahost
}

utils() {
	amove usr/bin
}

sha512sums="
9a24f40002b661d97c9b49a617d2e6b12bad1c9f22e872611252d051ec650f886c010207939fac6992610b3cd5a87588f802d7dfa1310ced7c6621ea2f99dd90  c-ares-1.28.1.tar.gz
"
